finding the value of n and r in permutation